type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
{$R *.DFM}

function SearchStr(source,SubStr:Pchar; 
                                      CallbackFunct:Pointer):Integer; 
                                       stdcall;external 'STRLIB.DLL'

{Ham  callback}
function EraseChar(source,subStr,
                                      pos:PChar):boolean; stdcall;
var i:integer;
begin
     
   for i:=0 to length(subStr)-1 do
      (pos+i)^:=#32;

     result:=true;
end;


procedure TForm1.FormCreate(Sender: TObject);
var source:PChar; count:integer
begin
  source:='Hello Borland Delphi';
  count:=SearchStr(source,'l',@EraseChar);

  caption:=source;
  ShowMessage('Total replace :'+intToStr(count));

end;

end.
